package cn.cvzhashi.oauth.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;

/**
 * @author cVzhanshi
 * @create 2022-10-25 18:18
 */
@Configuration
public class TokenConfig {

    @Bean
    public JwtAccessTokenConverter tokenConverter(){
        JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
        converter.setSigningKey("jwt_token");
        return converter;
    }

    // 令牌的存储策略
    @Bean
    public TokenStore tokenStore(){
        return new JwtTokenStore(tokenConverter());
    }
}
